package com.csii.activiti.server.api;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csii.activiti.server.api.vo.Result;
import com.csii.activiti.server.core.entity.ActFlowDetail;
import com.csii.activiti.server.core.entity.db.ActFlowPeopleWhoCopiedEntity;
import com.csii.activiti.server.core.query.QueryActFlowPeopleWhoCopied;
import com.csii.activiti.server.core.service.FlowPeopleWhoCopiedService;
import com.csii.activiti.server.core.service.FlowQueryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Api(tags="抄送人接口")
@RestController
@RequestMapping("/${activity.basic.url:activiti}/flow/pwc")
public class FlowPeopleWhoCopiedController {

    @Autowired
    private FlowPeopleWhoCopiedService flowPeopleWhoCopiedService;

    @Autowired
    private FlowQueryService flowQueryService;


    @ApiOperation("查询抄送人列表")
    @GetMapping("/queryPeopleWhoCopiedList")
    public Result<Page<ActFlowPeopleWhoCopiedEntity>> queryPeopleWhoCopiedList(QueryActFlowPeopleWhoCopied queryActFlowPeopleWhoCopied,
                                                                               @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
                                                                               @RequestParam(name="pageSize", defaultValue="10") Integer pageSize){
        return Result.ok(flowPeopleWhoCopiedService.queryPeopleWhoCopiedList(queryActFlowPeopleWhoCopied,new Page(pageNo, pageSize)));
    }


    @ApiOperation("查询抄送人详情")
    @GetMapping("/flowDetail")
    public Result<ActFlowDetail> queryFlowDetail(@ApiParam("抄送ID") @RequestParam String pwcId){
        return Result.ok(flowQueryService.queryFlowDetailByPwcId(pwcId));
    }


}
